package m.jclecai.com.adapter.holder.lotteryNumberMenu;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import butterknife.BindView;
import m.jclecai.com.R;
import m.jclecai.com.adapter.base.RyHolder;
import m.jclecai.com.adapter.lotteryNumberMenu.LotteryNumberLineAdapter;
import m.jclecai.com.bean.LotteryNumberMenuBean;
import m.jclecai.com.bean.MissDataBean;
import m.jclecai.com.listener.OnBallCheckedListener;

/**
 * Created by zed on 2018/3/19.
 */

public class LotteryNumberHolder extends RyHolder {
    @BindView(R.id.rv_num_line)
    public RecyclerView rvNumLine;

    @BindView(R.id.tvTitle)
    TextView tvTitle;
    LotteryNumberLineAdapter adapter;

    public LotteryNumberHolder(View itemView) {
        super(itemView);
        if (adapter == null) {
            adapter = new LotteryNumberLineAdapter(itemView.getContext());
            //初始化每行小球的界面
            rvNumLine.setLayoutManager(new GridLayoutManager(itemView.getContext(), 6));
            rvNumLine.setAdapter(adapter);
        }
    }

    public void init(int defCheckMenu, LotteryNumberMenuBean bean, int position, OnBallCheckedListener mOnBallCheckedListener) {
        tvTitle.setText("第" + (position + 1) + "位");
        adapter.setOnBallCheckedListener(mOnBallCheckedListener);
        adapter.setBean(bean);
        adapter.setLineIndex(position);
        adapter.setDefCheckMenu(defCheckMenu);
    }

    public void setMissDataBean(MissDataBean missDataBean) {
        adapter.setMissDataBean(missDataBean);
    }

    public void setShowMissData(boolean isShowMissData) {
        adapter.setShowMissData(isShowMissData);
    }
}
